Repository navigation
python-sdk: make ruff skip generated members - #95
Merged
Merged
Conversation
Signed-off-by: Yves Brissaud <yves@dagger.io>
Signed-off-by: Yves Brissaud <yves@dagger.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generation now writes a standalone
ruff.tomlinto each generated member:sdk/(includingsdk/entrypoint),clients/coreand everyclients/<name>. It goes throughreplaced()inscope.dang:Ruff uses the closest config and does not inherit it, so
ruff check .andruff format .from the module root skip generated code and still check the author's code.The file goes in the members, not the module root. The SDK never writes the module root, so an author's own root
ruff.tomlorpyproject.toml[tool.ruff]stays untouched and keeps working. A[tool.ruff]in the vendoredsdk/pyproject.tomlloses tosdk/ruff.toml.Tests
ruff.tomlfiles.generateleaves a user's rootruff.tomlunchanged.generated-ruff-skip-check, registered inengine-e2e. It runsruff check --show-files .from the module root with the ruff pinned insdk/uv.lock. It asserts that no listed path is undersdk/orclients/, and thatsrc/is listed.generated-ruff-skip-checkgenerate-scope-init-checkgenerate-scope-clients-checkruntime-call-checkgenerate-scope-existing-check(first revision of the series only)engine-e2echecks, includingfloor-coverage-check, were not run locally; CI runs them.Manual check on a generated default module with ruff 0.17.5 (earlier revision of the series, same behavior):
Limits
--force-excludeis set. Pre-commit's ruff hook sets it. With it,ruff format --check --force-exclude sdk/src/dagger/__init__.pyreports "No Python files found".ruff.tomlfiles at their next generate. Theirgenerate/stalecheck reports them once.